package com.egitim.util;

import javax.servlet.http.HttpServletRequest;

import org.apache.wicket.Request;
import org.apache.wicket.protocol.http.WebRequest;

public class UtilityUrl {
	 public static String getRequestUrl(Request comingRequest){
	        // this is a wicket-specific request interface
	        final Request request = comingRequest;
	        if(request instanceof WebRequest){
	            final WebRequest wr = (WebRequest) request;
	            // but this is the real thing
	            final HttpServletRequest hsr = wr.getHttpServletRequest();
	            String reqUrl = hsr.getRequestURL().toString();
	            final String queryString = hsr.getQueryString();
	            if(queryString != null){
	                reqUrl += "?" + queryString;
	            }
	            return reqUrl;
	        }
	        return null;

	    }
}
